/*
 JETI_EX_SENSOR.h, Version 0.1
 Mars 2012, by Denis Artru
 alarm and jetibox display are based on work of Uwe Gartmann and Alexander Buschek
 written for Arduino MEGA using rx2/tx2
*/

#ifndef JETI_EX_SENSOR_h
#define JETI_EX_SENSOR_h
#include <inttypes.h>
#include <arduino.h>

#define openEx

#ifdef openEx
#define JETI_SENSOR_ID1 0x00
#define JETI_SENSOR_ID2 0xA4
#define JETI_SENSOR_ID3 0x00
#define JETI_SENSOR_ID4 0x00
#else
#define JETI_SENSOR_ID1 0xB3
#define JETI_SENSOR_ID2 0x55
#define JETI_SENSOR_ID3 0xA8
#define JETI_SENSOR_ID4 0x55
#endif

#define JB_key_none     0b0000
#define JB_key_up       0b0010
#define JB_key_right    0b0001
#define JB_key_down     0b0100
#define JB_key_left     0b1000

void JETI_Init(const prog_char* sensorName);
uint8_t JETI_addData(const prog_char* name, const prog_char* unit);
void JETI_setValue(uint8_t ident, int32_t* valuePtr, uint8_t precision=0);
void JETI_setValueTime(uint8_t ident, uint8_t[3]);
void JETI_setValueDate(uint8_t ident, uint8_t[3]);
void JETI_setValueGPS(uint8_t ident, uint8_t[4]); /* [0] NESW , [1] angle, [2][3] minute/1000*/
void JETI_unsetValue(uint8_t ident);
void JETI_JetiBox(const char* line1, const char* line2);
void JETI_JetiBox_P(const prog_char* line1, const char* line2);
bool JETI_createFrame();
void JETI_alarm(char alarmLetter);
uint8_t JETI_readbuttons();

extern volatile uint8_t JetiFrameState;

#endif
